﻿using PageAdmin.Utils.ORM;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace PageAdmin.Utils.BLL
{
    /// <summary>
    /// 查询接口，单页查询和分页查询共用
    /// </summary>
    public interface IGetListData<T> where T : class, new()
    {

        /// <summary>
        /// 执行前的委托
        /// </summary>
        Func<TipsInfo> Executing { get; set; }

        /// <summary>
        /// 执行后的委托
        /// </summary>
        Action<IEnumerable<T>> Executed { get; set; }

        /// <summary>
        /// 默认排序方式
        /// </summary>
        string OrderBy { get; set; }

        /// <summary>
        /// 自定义附件查询条件
        /// </summary>
        string QueryCondition { get; set; }

        /// <summary>
        /// 显示的数量
        /// </summary>
        int? ShowNumber { get; set; }

        /// <summary>
        /// 自定义附加参数，和_QueryCondition
        /// </summary>
        DynamicDbParameters QueryDbParameters { get; set; }

        /// <summary>
        /// 获取数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="form"></param>
        /// <returns></returns>
        IEnumerable<T> GetList(NameValueCollection form);

        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="form"></param>
        /// <returns></returns>
        IEnumerable<T> GetPageList(NameValueCollection form, PageInfo PageInfo);

    }
}